<template>
  <el-form-item :class="getClz(['autoheight'])" :label="opt.text" :prop="opt.name" v-if="!opt.hide" size="small" v-bind="opt.itemProps">
    <EditorVue ref="$editor" @change="changeHtml" />
  </el-form-item>
</template>

<script>
  import EditorVue from "@/components/UEditor/index";
  import extend from '../extend';
  let Log = ()=>{};

  export default {
    name: "FormSelect",
    components:{EditorVue},
    mixins:[extend],
    dicts:[],
    data(){
      return {
        opt: {
          name:'',
          text:'',
          prop:'',
          itemProps:{
          },
          props:{
            disabled:false,
            filterable:true
          },
          hide:false,
          placeholder:''
        }
      }
    },
    mounted(){
      this.initOptions();
      this.onChange = this.opt.onChange||Log;
    },
    methods:{
      setValue(val = ''){
        this.$refs.$editor.editor.setHtml(decodeURIComponent(val))
      },
      changeHtml({editor}){
        this.data[this.opt.name] = encodeURIComponent(editor.getHtml());
      }
    }
  }
</script>

<style scoped>
</style>
